﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;

namespace ProjetoFinal
{

    public class Monckey
    {
        Texture2D texture;
        public Rectangle rect;
        public Vector2 speed;
  

        public Monckey(Rectangle rect, Vector2 speed)
        {
            this.rect = rect;
            this.speed = speed;

        }

        public void LoadContent(ContentManager content)
        {
            texture = content.Load<Texture2D>("monckey");
        }

        public void Move()
        {
            if (!(rect.X >= 1024 - rect.Width) || (rect.X != 0))// se n passou da tela direita
            {
                rect.X += (int)speed.X * -1;
                rect.Y += (int)speed.Y * -1;
            }

            if ((rect.X >= 1024 - rect.Width) || (rect.X == 0) || (rect.Y > 768))
            {
                speed.X *= -1;

            }

            if (rect.Y <= 0)
            {
                speed.Y *= -1;

            }

        }

        public void BackToPosition(ref int life, ref bool lostLife)
        { // posicao inicial
            if (rect.Y + rect.Height >= 768)
            {
                life--;
                rect.X = 360;
                rect.Y = 510;
                lostLife = true;
            }
        }

        public void Draw(SpriteBatch spriteBatch)
        {
            spriteBatch.Draw(texture, rect, Color.White);
        }

    }
}
